/** 
 * @file output.h
 * @brief 
 * @author Red Li
 * @version 1.0.0
 * @date 2009-08-16
 */


#ifndef _OUTPUT_H
#define _OUTPUT_H


/* --------------------------------------------------------------------------*/
/** 
 * @brief for statis 
 * 
 * @review draft
 */
/* ----------------------------------------------------------------------------*/
typedef enum
{
	QUERY = 0,
	AUTHQUERY,
	ACCTQUERY,
	TRANS,
	AUTHTRANS,
	ACCTTRANS,
	SESSION,
	OTHERTYPE,
	CLIENT_END,
	_SERVER,
	SERVER_END,
	CLASS_END
}STATIS_CLASS;

typedef enum
{
	TOTAL_LOST = 0,				//!< packets have droped
	TOTAL_PKTS,				//!< total packets received
	TOTAL_AUTH,				//!< auth packets
	TOTAL_REJECT,			//!< pakcets have rejected
	SERVER_TYPE_END
}SERVER_STATIS_TYPE;

typedef enum
{
	SENT = 0,
	RESENT,
	COMPLETED,
	ACCEPTED,				//!< only for auth
	REJECT,					//!< only for auth
	DETECTLOST,				//!< receive a wrong package
	TIMEOUT,				//!< timeout packet
	TYPE_END
}STATIS_TYPE;

/* --------------------------------------------------------------------------*/
/** 
 * @brief client state structure
 * 
 * @review draft
 */
/* ----------------------------------------------------------------------------*/
typedef enum
{
	CLIENT_IDLE = 0,		//!< ... idle
	CLIENT_BUSY,			//!< ... busy
	CLIENT_DEAD,			//!< clients whoes state is dead
	CLIENT_TOTAL			//!< total number of clients
}client_state_t;


/* --------------------------------------------------------------------------*/
/** 
 * @brief for multiport
 * 
 * @review draft
 */
/* ----------------------------------------------------------------------------*/
typedef struct resources_t
{
	int sockfd;
	char radius_id[256];
	int cur;
	int num_used;
}resources_t;


int output_init();

void output_refresh(int sig);

void output_close();


#endif

